import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:news_flutter/models/hot_search_key_model.dart';
import 'package:news_flutter/utils/precompile.dart';
import 'package:news_flutter/widgets/custom/my_diver_widget.dart';
import 'package:news_flutter/extension/num_ext.dart';
class HotSearchItem extends StatelessWidget {
  final HotSearchKeyModel model;
  final int index;
  final CallBackWithObject tapCallback;
  const HotSearchItem({Key key, this.model, this.index, this.tapCallback}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap:(){
        if (tapCallback!=null){
          tapCallback(model);
        }
      },
      child: Column(
        children: <Widget>[
          Container(
            padding: EdgeInsets.symmetric(vertical: 10),
            child: Row(
              children: <Widget>[
                //下标
                Container(
                  margin: EdgeInsets.only(left: 10),
                  child: Text("${index+1}",style: TextStyle(color: index<3?MyColor.STYLE_RED:MyColor.TEXT_GRAY,fontSize: 13,fontWeight: index<3?FontWeight.bold:FontWeight.normal),),
                ),
                //标题
                Expanded(
                  child: Container(
                    margin: EdgeInsets.only(left: 10),
                    child: Text(model.word??"",style: TextStyle(color: index<3?MyColor.STYLE_RED:MyColor.TEXT_GRAY,fontSize: 15,fontWeight: index<3?FontWeight.bold:FontWeight.normal),maxLines: 1,),
                  ),
                ),
                //指数
                Container(
                  margin: EdgeInsets.only(right: 10),
                  child: Text("${model.hotindex.friendlyNumWanDes()}",style: TextStyle(color: MyColor.TEXT_GRAY,fontSize: 13,fontWeight: index<3?FontWeight.bold:FontWeight.normal),),
                ),
              ],
            ),
          ),
          MyDiver(),
        ],
      ),
    );
  }
}
